
public class StringToken extends Token {

	public String value;
	
	public Object getValue() {
		// if empty string then length is 2 (2 " chars)
		// value = (image.length()<3)?"":image.substring(1, image.length()-1);
		if(image.equals(""))
			return "\"\"";
		
		// stripping the quotation marks
		//value = image.substring(1, image.length()-1);
		value = image;
		
		// converting to char array for looping
		char[] array = value.toCharArray();
		char c, lookahead;
		
		StringBuffer sb = new StringBuffer();
		for(int i=0  ; i<array.length ; i++ ) {
			c = array[i];
			if(i >= array.length - 1) {
				sb.append(c);
				break;
				
			}else
				lookahead = array[i+1];
			
			if(c == '\\') {
				if(lookahead == '\\') {
					sb.append('\\'); //  append only one
					
				}else if(lookahead == 't') {
					sb.append('\t');
					
				}else if(lookahead == 'n') {
					sb.append('\n');
					
				}else if(lookahead == 'r') {
					sb.append('\r');
					
				}else if(lookahead == '\"') {
					sb.append('\"');
					
				}
				

				i++;			// move ahead
				
			}else{
				sb.append(c);
			}
		}
		
		
		return sb.toString();
	}
}
